package com.esisa.utils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateSessionFactory {
	private static SessionFactory sessionFactory=null;
	
	static
	{
		try {
			System.out.println(">>> HibernateSessionFactory STATIC BLOCK");
			Configuration conf = new Configuration().configure();
			sessionFactory=conf.buildSessionFactory();
			System.out.println(">>> Fin de configuaration");
			
	
		} catch (Exception e) {
			System.err.println("Initial SessionFactory creation failed." + e);
		}
	}
	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	public static org.hibernate.Session openSession() {
		return sessionFactory.openSession();
	}
	
}
